package com.jt.tenant.activity;

import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import com.jt.tenant.R;
import com.jt.tenant.app.JTApplication;
import com.zcx.helper.activity.AppActivity;

import cn.jpush.android.api.JPushInterface;
import qiu.niorgai.StatusBarCompat;

/**
 * Created by Administrator on 2016/1/30.
 */
public abstract class JTTitleActivity extends AppActivity {

    protected Typeface mTfRegular;

    protected Typeface mTfLight;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        JTApplication.INSTANCE.addActivity(this);

        Log.e(getClass().toString(), "show");

        mTfRegular = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

        mTfLight = Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf");

    }

    @Override
    public void setContentView(int layoutResID) {

        super.setContentView(layoutResID);

        JTApplication.ScaleScreenHelper.loadView((ViewGroup) getWindow().getDecorView());

    }

    @Override
    protected void onResume() {

        super.onResume();

        JPushInterface.onResume(this);

    }

    @Override
    protected void onPause() {

        super.onPause();

        JPushInterface.onPause(this);

    }

    @Override
    protected void onDestroy() {

        super.onDestroy();

        JTApplication.INSTANCE.finishActivity(this);

        System.gc();

    }

    public void onBack(View v){

        finish();

    }

//    public void onSettingClick(View v){
//
//        startActivity(new Intent(this,SettingActivity.class));
//
//    }
//
//    public void onPersonClick(View v){
//
//        startActivity(new Intent(this,PersonActivity.class));
//
//    }

    public void onCallCS(View v){

        Intent intent = new Intent(Intent.ACTION_DIAL);
        Uri data = Uri.parse("tel:" + "4006115616");
        intent.setData(data);
        startActivity(intent);

    }

    public void onBottomClick(View v){

    }

    public void onRightClick(View v){


    }

    public void onCarEdit(View v){


    }

    protected String[] mMonths = new String[] {
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"
    };





    protected float getRandom(float range, float startsfrom) {
        return (float) (Math.random() * range) + startsfrom;
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(R.anim.move_left_in_activity, R.anim.move_right_out_activity);
    }
}
